package com.example.pickupclosefirstdemo.application;

import android.app.Application;

import com.alibaba.android.arouter.launcher.ARouter;
import com.example.pickupclosefirstdemo.util.LogUtil;

public class MVApplication extends Application {

    public static final boolean isShow = true;
    private boolean isDebugARouter = true;

    public static MVApplication instance;

    public static MVApplication getInstance(){
        if (instance == null) {
            instance = new MVApplication();
        }
        return instance;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        instance = this;
        LogUtil.init(isShow);

        if (isDebugARouter) {
            //必须在init之前
            ARouter.openLog();//打印日志
            ARouter.openDebug();//线上版本需要关闭
        }
        ARouter.init(this);
    }

    @Override
    public void onTerminate() {
        super.onTerminate();
        ARouter.getInstance().destroy();
    }
}
